package com.mycompany.lctwitter.action.user;

import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import com.mycompany.lctwitter.action.AbstractAction;
import com.mycompany.lctwitter.persist.model.User;
import com.opensymphony.xwork2.Action;

@Results( { @Result(name = Action.INPUT, location = "/WEB-INF/web/user/login-page.ftl") })
public class HelloWorldAction extends AbstractAction {
    private static final long serialVersionUID = 8979797209383342934L;
    private String message;

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String execute() {
        User user = (User) session.get(LOGINED_USER);
        if (user == null)
            return INPUT;
        this.message = user.getUserName();
        return SUCCESS;
    }
}
